package cn.org.xuanzp.nty.server.handler;

import cn.hutool.json.JSONUtil;
import cn.org.xuanzp.common.command.Command;
import cn.org.xuanzp.common.utils.CommandUtils;
import cn.org.xuanzp.nty.utils.NettyServerUtil;

/**
 * @Classname TransmitCommandHandler
 * @Description 消息转发
 * @Version 1.0.0
 * @Date 2024/9/22 23:58
 * @Created by xuanzp
 */
public class TransmitCommandHandler implements CommandHandler {
    /***
     * 指令处理
     * @param command
     */
    @Override
    public void handler(Command command) {
        // TODO 消息转发
        System.out.println("TransmitCommandHandler.command = " + JSONUtil.toJsonStr(command));
        String toId = (String) command.getHeaders().get(CommandUtils.COMMAND_HEADER_TO);
        NettyServerUtil.transmit(toId,command);
    }
}
